DECLARE @ObjectName NVARCHAR(100)
SELECT @ObjectName = CONCAT('ALTER TABLE RemoteXDAInstance DROP CONSTRAINT ', (SELECT name 
FROM sys.foreign_keys
WHERE referenced_object_id = object_id('UserAccount') AND parent_object_id = object_id('RemoteXDAInstance')
))
EXECUTE sp_executesql @ObjectName
GO
ALTER TABLE RemoteXDAInstance
DROP COLUMN UserAccountID
GO

ALTER TABLE RemoteXDAInstance ADD
RegistrationKey VARCHAR(50) NOT NULL DEFAULT(''),
APIToken VARCHAR(50) NOT NULL DEFAULT('')
GO

CREATE TABLE [OpenSEE.Setting](
    ID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY,
    Name VARCHAR(200) NOT NULL UNIQUE,
    Value VARCHAR(MAX) NULL,
    DefaultValue VARCHAR(MAX) NULL
)
GO

INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('applicationName', 'OpenSEE', 'OpenSEE')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('applicationDescription', 'Event Viewing Engine', 'Event Viewing Engine')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('applicationKeywords', 'open source, utility, browser, power quality, management', 'open source, utility, browser, power quality, management')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('bootstrapTheme', '~/Content/bootstrap-theme.css', '~/Content/bootstrap-theme.css')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('useLLVoltage', 'false', 'false')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('SlidingCacheExpiration', '2.0', '2.0')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('maxSampleRate', '-1', '-1')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('minSampleRate', '-1', '-1')
GO
INSERT INTO [OpenSEE.Setting](Name, Value, DefaultValue) VALUES('maxFFTHarmonic', '50', '50')
GO

